package com.meizi.mall.search.web;

import com.meizi.mall.search.service.SearchService;
import com.meizi.mall.search.vo.SearchParam;
import com.meizi.mall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author meizi
 * @email enjoymeizi@gmail.com
 * @date 2021/1/21 16:30
 */
@Controller
public class SearchController {
    @Autowired
    SearchService searchService;
    //?keyword=华为&catalog3Id=225&attrs=15_海思（Hisilicon）:以官网信息为准&attrs=16_HUAWEI Kirin 970&skuPrice=5000_6000
    @GetMapping("/list.html")
    public String indexOfSearch( SearchParam searchParam,Model model){
        SearchResult result = searchService.searchInfo(searchParam);
        model.addAttribute("result",result);
        return "index";
    }
}
